//
//  SceneArmBaseViewController.h
//  wAudioShare
//
//  Created by Anson on 14-11-11.
//  Copyright (c) 2014年 赵帅. All rights reserved.
//

#import "ShowHomeBaseViewController.h"

#import "Utitlity.h"
#import "ActionPicker.h"
#import "SceneDeviceModel.h"
#import "SceneDeviceCell.h"
#import "ArmModel.h"

typedef NS_ENUM(NSInteger, PICKER_VIEW_TAG) {
    
    PICKER_VIEW_DEVICE_LIST_TAG = 100,
    PICKER_VIEW_FUNCTION_LIST_TAG = 200,
    PICKER_VIEW_TEMPERATURE_LIST_TAG = 300,
    PICKER_VIEW_THERMOSTATMODE_TAG = 400,
    PICKER_VIEW_ARM_CONDITIONLIST_TAG,
    PICKER_VIEW_ARM_CONDITION_STATE_TAG,
    
    PICKER_VIEW_TAG_CONDITION
};

@interface SceneArmBaseViewController : ShowHomeBaseViewController <UIPickerViewDelegate,UIPickerViewDataSource,UITableViewDataSource, UITableViewDelegate, ActionPickerDelegate>
{
    NSString *ipUrl;
    
    SceneDeviceType _currentSelectDeviceType;
    NSArray *_temperatureArray;
    NSArray *_dimmerLightPercent;
    NSArray *_funcionOnOff;
    NSArray *_thermostatAirMode;
    NSArray *_multiLevelSensorVal;
    
    //!*** 条件列表
    NSArray *_armConditionList;
    NSArray *_armConditionStateList;
    
    UIPickerView *_pickerView_DeviceList;
    UIPickerView *_pickerView_Switch;
    UIPickerView *_pickerView_DimmerLight;
    UIPickerView *_pickerView_Temperature;
    UIPickerView *_pickerView_ThermostatMode;
    
    UIPickerView *_pickerView_ArmConditionList;
    UIPickerView *_pickerView_ArmStateList;
    
    UIPickerView *ios8Picker;
    
    //!当前编辑一个已添加设备的状态信息
    BOOL _currentEditAttachedDevice;
}

@property (nonatomic,retain) ActionPicker *actionPicker;
@property (strong,nonatomic) NSMutableArray *canSelectDeviceList;//可选的设备列表
@property (strong, nonatomic) NSDictionary *selectedDeviceItemData;//准备要添加已选设备（来自于canSelectDeviceList）
@property (strong,nonatomic) NSMutableArray *attachDeviceModelList;//已经添加的设备列表
@property (strong, nonatomic) SceneDeviceModel *addDeviceFunctionModel;//设备功能
@property (strong, nonatomic) ArmModel *sceneAddArmConditionModel;//情景添加添加的Model

@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
@property (weak, nonatomic) IBOutlet UIButton *btnDeviceListSelect;
@property (weak, nonatomic) IBOutlet UIButton *btnFunctionListSelect;
@property (weak, nonatomic) IBOutlet UITableView *attachDeviceListView;

//!*** 在情景下选择的条件列表
@property (weak, nonatomic) IBOutlet UIButton *btnSceneArmListSelect;
//!*** 在情景下选择的条件是否激活
@property (weak, nonatomic) IBOutlet UIButton *btnSceneArmStateSelect;

- (IBAction)deviceListSelectBtnClicked:(id)sender;
- (IBAction)functionSelectedBtnClicked:(id)sender;
- (IBAction)editAttachDeviceListBtnClicked:(id)sender;
- (IBAction)backToPreViewControllerBtnClicked:(id)sender;

- (void)setSelectDeviceList:(NSArray *)deviceList;

-(void)doChoose:(NSInteger)tag;
- (void)reSetDevListSelect;
- (void)resetSceneAddArmSelect;
-(void)deleteAttachDevice:(id)modelData;

- (void)pickerViewConfirmForFunctionList:(NSInteger)picker_selected_index;
- (void)pickerViewConfirmForSceneArmState:(NSInteger)picker_selected_index;

- (void)replaceDeviceModelListWithData:(SceneDeviceModel *)data;
- (void)replaceSceneArmModelListWithData:(ArmModel *)replaceData;

- (void)sendReqAddNewDeviceToSceneWithURL:(NSString *)urlStr thermostateBaseUrl:(NSString *)urlBase;
- (void)sendReqConfigAttachDeviceWithURL:(NSString *)urlStr thermostateBaseUrl:(NSString *)urlBase;

@end
